<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>函数</title>
</head>
<body>
    <script>
       
        // func1(100);
        // func1(100,200);
        // func1(100,200,300);
        // let result = func1(10,20);
        // console.log(result);

        // let func2 = function(){
        //     console.log("func2");
        // }
        
        // func2();

      
        function func1(a,b){
            console.log("second");
            console.log(a,b);
            // 伪数组
            console.log(arguments[0],arguments.length);

            return a + b;
        }

        func1(1,2,3);
        // 立即执行的匿名函数IIFE
        (function(){
            console.log("匿名函数")
        })();

        // 编写函数，输出任意范围的质数
        function isPrime(number){
            for(let i = 2;i < number;i++){
                if(number % i == 0){
                    return false;
                }
            }
            return true;
        }
        function printPrime(start,end){
            for(let i = start;i < end;i++){
                if(isPrime(i)){
                    console.log(i + "是质数")
                }
            }
        }
        printPrime(100,1000);
    </script>
</body>
</html>